// Filename: graphicsclass.h
#pragma once

// Includes
#include "d3dclass.h"
#include "cameraclass.h"
#include "modelclass.h"
#include "lightshaderclass.h"
#include "lightclass.h"
#include "textclass.h"
#include "bitmapclass.h"
#include "textureshaderclass.h"

#include <windows.h>
#include <string>
#include <vector>
#include <fstream>
using namespace std;

// Globals
const bool	FULL_SCREEN		= false;
const bool	VSYNC_ENABLED	= true;
const float SCREEN_DEPTH	= 1000.0f;
const float SCREEN_NEAR		= 0.1f;

/// <Summary>
/// GraphicsClass: Encapsulates all graphics rendering.
/// </Summary>
class GraphicsClass
{
public:
	GraphicsClass();
	GraphicsClass(const GraphicsClass&);
	~GraphicsClass();

	bool Initialize(int screenWidth, int screenHeight, HWND hwnd);
	void Shutdown();

	bool Frame(int mouseX, int mouseY, vector<char>& inputb, string& command);
	bool Render(float rotation);
	
	void ProcessCommand(const string& command);

	// Helper methods.

	bool Check_result(bool result, PWSTR message) const;
	void Write_GPUInfo();

private:
	D3DClass*			m_D3D;				// Handles all Direct3D system functions
	CameraClass*		m_Camera;			// Handles calculation of the view matrix
	ModelClass*			m_Model;			// Stores the triangle model.
	LightShaderClass*	m_LightShader;		// Initializes, shutdowns, and renders the light shader.
	LightClass*			m_Light;			// Holds the light sources in the scene - colour and direction.

	BitmapClass*		m_Bitmap;			// Stores a dynamic bitmap.
	TextureShaderClass* m_TextureShader;	// Shader tha renders only textures.
	TextClass*			m_Text;				// Handles application's text rendering.

	D3DXMATRIX			m_guiView;			// View matrix for GUI rendering.
	float				m_clearcolor[3];	// Temp: Render target clear colour.
	string				m_previousCommand;	// Previous grahphics command.
};